package cn.uc.grapics;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Paint.Style;

public class TextItem extends GraphicsItem{
    private String text;
    private int textColor = Color.BLACK;
    private float textSize = 20f;
    
    public TextItem(String aText){
        text =aText;
    }
    
    public void setText(String aText){
        text =aText;
    }
    
    public String getText(){
        return text;
    }
    
    public void setTextColor(int aColor){
        textColor = aColor;
        
    }
    
    public void setTextSize(float aSize){
        textSize = aSize;
    }

    @Override
    protected void paint(Canvas aCanvas) {
        // XXX Auto-generated method stub
        Paint sPaint = new Paint();
        sPaint.setColor(textColor);
        sPaint.setTextSize(textSize);
        aCanvas.drawText(text, boundingRect().left, boundingRect().top, sPaint);
    }
    
    public Rect boundingRect(){
        boundingRect.set(boundingRect.left, boundingRect.top, boundingRect.left + 100, boundingRect.top + 20);
        return boundingRect;
    }

}
